
import { createForm } from '@formily/core';
import { Field, createSchemaField } from '@formily/react';
import 'antd/dist/antd.css';
import { Form, FormItem, Input } from '@formily/antd';
//纯JSX
const form = createForm();
const SchemaField = createSchemaField({
  components: {
    FormItem, Input
  }
});
const schema = {
  type: 'object',
  properties: {
    name: {
      title: '姓名',
      type: 'string',
      required: true,
      'x-decorator': 'FormItem',
      'x-component': 'Input'
    },
    email: {
      title: '邮箱',
      type: 'string',
      required: true,
      'x-validator': 'email',
      'x-decorator': 'FormItem',
      'x-component': 'Input'
    }
  }
}
function App() {
  return (
    <Form form={form} labelCol={6} wrapperCol={5}>
      <SchemaField schema={schema} />
    </Form>
  )
}
export default App